package com.adingxiong.security.springsecurity.entity;

import java.time.LocalDateTime;

/**
 * @ClassName SmsCode
 * @Description   短信登录验证
 * @Author xiongchao
 * @Date 2020/10/19 10:21
 **/
public class SmsCode  {
    private String code;

    private LocalDateTime expireTime;

    public SmsCode(String code ,LocalDateTime expireTime){
        this.code = code;
        this.expireTime = expireTime;
    }

    public SmsCode(String code ,int time){
        this.code = code;
        this.expireTime = LocalDateTime.now().plusSeconds(time);
    }

    public boolean isExpire(){
        return LocalDateTime.now().isAfter(expireTime);
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public LocalDateTime getExpireTime() {
        return expireTime;
    }

    public void setExpireTime(LocalDateTime expireTime) {
        this.expireTime = expireTime;
    }
}
